<?php
//	echo "<pre>";
//	var_dump($mengajar_kelas);
//	print_r($_POST);
//	echo "</pre>";
//	die();
?>
<div id="isikiri">
    <div id="tempatfoto">
        <img src="<?php echo base_url()."/foto/".$this->session->userdata('foto'); ?>" width="267" height="400" />
	</div>
    <p>&nbsp;</p>
</div>
<!---mulai div isikanan --->
<div id="isikanan">
	<div class="din pel"><?php echo $this->session->userdata('nama'); ?><span class="black">Edit</span></div>
	<?php  echo $this->load->view("schedule/profile_nav") ?>
	<div class="clear"></div>
	<!---mulai div biodata --->
	<div id="biodata">
		<div class="xmen din">Edit Role</div>

		<div>
			<form method="post" action="<?php echo current_url(); ?>">
				<div class="judulform">Kode Pelatihan</div>
				<?php echo form_dropdown('kode_pelatihan', $courses	, $mengajar_kelas['kode_pelatihan'], "class='isian f0' id='select2' onchange='this.form.submit()'"); ?>
			</form>

			<?php if($mengajar_kelas['kode_pelatihan'] == "-") {?>
				<div class="judulform xmen din"><?php echo "Pilih kode Pelatihan"; ?></div>
			<?php } else {?>
				<div class="judulform xmen din"><?php echo $mengajar_kelas['nama_pelatihan']; ?></div>
			<?php } ?>
		</div>

		<?php if ($mengajar_kelas['kode_pelatihan'] != "-") {?>
		<?php echo form_open("schedule/schedule_con/update_role"); ?>
		<input type="hidden" name="kode_pelatihan" value="<?php echo $mengajar_kelas['kode_pelatihan']; ?>" />
		<div class="judulform">
            <table border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td rowspan="<?php echo count($roles)+1; ?>" valign="top">Sebagai</td>
				</tr>

				<?php foreach ($roles as $row) { ?>
				<tr>
					<td valign="top">
						<?php if ($this->courses->is_role_exist("id_role", $row['values'], $mengajar_kelas['kode_pelatihan'])) { ?>
						<input type="checkbox" name="role[]" value="<?php echo $row['values']; ?>" checked="checked" id="checkbox" /><?php echo $row['text']; ?>
						<?php } else {?>
						<input type="checkbox" name="role[]" value="<?php echo $row['values']; ?>" id="checkbox" /><?php echo $row['text']; ?>
						<?php }?>
					</td>
				</tr>
				<?php } ?>
            </table>
			<input type="hidden" name="count_roles" value="<?php echo count($roles)?>" />
		</div>
			<div class="judulform">Availability</div>
			<div class="isian f2">
				<table border="0" cellspacing="0" cellpadding="0">
					<tr>
						<?php for($i=0; $i<count($mengajar_kelas['tahun_term']); $i++) { ?>
							<?php if(!($odd = ($i+1)%2 )) { ?>
							<td class="garistengah"></td>
							<?php }?>
							<td>
								<?php if($mengajar_kelas['tahun_term'][$i]['selected']) {?>
								<input type="checkbox" checked="checked" name="tahun_term[]" id="checkbox" value="<?php echo $mengajar_kelas['tahun_term'][$i]['data']; ?>" />
								<?php } else {?>
								<input type="checkbox" name="tahun_term[]" id="checkbox" value="<?php echo $mengajar_kelas['tahun_term'][$i]['data']; ?>" />
								<?php }?>
								Term-<?php echo $mengajar_kelas['tahun_term'][$i]['term']." ".$mengajar_kelas['tahun_term'][$i]['tahun']; ?>
							</td>
						<?php }?>
					</tr>
				</table>
				<input type="hidden" name="count_check" value="<?php echo count($mengajar_kelas['tahun_term'])?>" />
			</div>
			<div>

			</div>
			<div class="tempatbutton">
				<input class="save" type="submit" name="button" id="button" value="Save" />
			</div>
		<?php }?>
		<?php echo form_close(); ?>
	</div>
</div>